<?php

use Faker\Generator as Faker;

$factory->define(\App\Models\Product::class, function (Faker $faker) {
    return [
        'name' => $faker->text(20),
        'summary' => $faker->text(200),
        'category_id' => randArray(\App\Models\Category::query()
            ->doesntHave('children')->get()->pluck('id')->toArray(), 1),
        'status' => 1,
        'price' => [
            'current' => price(rand(100, 999)),
            'original' => price(rand(1000, 9999)),
            'wholesale' => price(rand(10, 99)),
        ],
        'count_reviews' => rand(0, 999),
        'count_sales' => rand(0, 99),
        'count_comments' => rand(0, 999)
    ];
});

$factory->define(\App\Models\ProductSku::class, function (Faker $faker) {
    $price = rand(10, 999);
    return [
        'price' => [
            'current' => price($price * 10),
            'original' => price($price * 100),
            'wholesale' => price($price * 5),
        ],
        'stock' => rand(100, 999),
    ];
});
